<?php
/**
 * @var $this Pinenut\Action
 * @var $itemProfile \Users\Profile
 * @var $companionProfileId string
 * @var $myProfileId string
 * @var $groupId string
 */

$avatarType = $itemProfile->getAvatarType();
if (null !== $avatarType) {
	$avatarTypeClass = $avatarType . '-profile';
}
?>
<li uid="<?php echo $itemProfile; ?>" data-gid="<?php echo $groupId; ?>"
	class="messenger-usersList-itemBlock
		<?php echo $companionProfileId == $itemProfile ? 'active' : ''; ?>
		<?php echo $avatarTypeClass ?>
	">

	<div class="mdu-avatar avatar-sm avatar-item"
		 <?php if (null === $avatarTypeClass) { ?>
			style="background-image: url(<?php echo $this->url('photos.thumb', ['id' => $itemProfile->getAvatar()->_id, 'thumb' => 'messenger']); ?>)"
		 <?php } ?>
		 ></div>

		<?php if (!$itemProfile->isBlocked && !$itemProfile->isDeleted): ?>
		<?php echo $this->action('profiles.online', ['id' => (string)$itemProfile], 'messenger'); ?>
	<?php endif; ?>
	<div class="mdu-name">
		<?php echo $this->txt2html($itemProfile->nickname); ?>
	</div>

	<div class="mdu-country">
		<?php if ('blocked' == $avatarType) { ?>
			<?php echo 'Blocked user'; ?>
		<?php } else if ('deleted' == $avatarType) { ?>
			<?php echo 'Deleted user'; ?>
		<?php } else if ('support' == $avatarType) { ?>

		<?php } else { ?>
			<?php echo $this->txt2html($itemProfile->getCountryName()); ?>
		<?php } ?>
	</div>

	<?php echo $this->action(
		'.unreadMessagesCount',
		[
			'groupId' => (string)$groupId,
			'targetProfileId' => $myProfileId,
		]
	); ?>
</li>